﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Infrastructure.Aspect.Unity.Converts
{
    public class ConnectionStringConverter : System.ComponentModel.TypeConverter
    {
        public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            if (value != null &&   value is String)
            {
                return ConfigurationManager.ConnectionStrings[value.ToString()].ConnectionString; 
            }
            return null;  
        }
    }
}
